package cn.wolfcode.mapper;

import cn.wolfcode.domain.Role;
import cn.wolfcode.qo.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Role role);
    int updateByPrimaryKey(Role role);

    Role selectByPrimaryKey(Long id);
    List<Role> selectAll();
    List<Role> selectForList(QueryObject qo);

    // 插入关系 将角色id和权限id绑在一起
    void insertRelation(@Param("roleId") Long id, @Param("permissionId") Long permissionId);

    // 删除关系 => 角色和权限之间
    void deleteByRelation(Long roleId);

    // 查询角色 => 员工和角色之间
    List<Role> selectByEmployeeId(Long employeeId);
}